{if $isDebugging}

    {function name="PrintException" ex=""}
    <h3>{get_class($ex)}</h3>
    <dl>
        <dt>Message</dt>
        <dd>
            <p class="debug-message">{$ex->getMessage()}</p>
            <p>
                At <span class="debug-file">{$ex->getFile()}</span>
                (<span class="debug-line">{$ex->getLine()}</span>)
            </p>
        </dd>
        {$trace = $ex->getTrace()}
        {if $trace}
            <dt>Stack trace</dt>
            <dd>{call name="PrintStackTrace" stack=$ex->getTrace()}</dd>
        {/if}
        {$prev = $ex->getPrevious()}
        {if $prev}
            <dt>Inner exception</dt>
            <dd>
                {call name="PrintException" ex=$prev}
            </dd>
        {/if}
    </dl>
    {/function}

    {function name="PrintStackTrace" stack=array()}
    <ol class="stack-trace">
        {foreach $stack as $item}
            <li>
                <div class="location">
                    {if array_key_exists("file", $item)}
                        <span class='debug-file'>{$item["file"]}</span>
                    {/if}
                    {if array_key_exists("line", $item)}
                        (<span class='debug-line'>{$item["line"]}</span>): 
                    {/if}
                </div>
                <div class="method-call">
                    {if array_key_exists("class", $item)}
                        <strong class="debug-class">{$item["class"]}</strong>
                        <span class="debug-type">{$item["type"]}</span>
                    {/if}
                    <strong class="debug-function">{$item["function"]}</strong>(
                    {foreach $item["args"] as $arg}
                        {if is_object($arg)}
                            <em>object:</em> {get_class($arg)}
                        {else}
                            <em>{gettype($arg)}:</em>
                        {/if}
                        {if is_scalar($arg)}
                            <span class="debug-literal">"{$arg}"</span>
                    {/if}{if !$arg@last},{/if}
                {/foreach})
            </div>
        </li>
    {/foreach}
</ol>
{/function}


<style type="text/css">
    {literal}
        dl, dt, dd{
            text-align: left;
            display: block !important;
            float: none !important;
        }
        dt{
            border:1px solid #fff;

            border-radius: 5px;
            -moz-border-radius: 5px;
            -webkit-border-radius: 5px;

            -moz-box-shadow: 1px 1px 0px #999;
            -webkit-box-shadow: 1px 1px 0px #999;
            box-shadow: 1px 1px 0px #999;

            background:#fbfbfb;
            background: -moz-linear-gradient(top,#fbfbfb,#f5f5f5);
            background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#f5f5f5));

            padding:5px 20px;
            text-transform:uppercase;
            font-size:11px;
        }

        dd dl{
            margin-left: 80px;
        }
        .debug-file{
            color:#990000;
        }
        .debug-line{
            color:green; 
        }

        .debug-message{
            color: #3366FF;
        }
        .debug-literal{
            color: #E03F0D;
        }
        .stack-trace li {
            margin-bottom: 3px;
            padding: 7px;
            border-radius: 5px;
            -moz-border-radius: 5px;
            -webkit-border-radius: 5px;
        }
        .stack-trace li:hover {
            background-color: #E1E1E1;
        }
        .stack-trace div.method-call {
            margin-left: 10px;
        }
    {/literal}
</style>
<div>
    <h1>An Exception ocurred</h1>
    {call name="PrintException" ex=$ex}
</div>
{/if}

<ul>
    <li>
        <a href="{$lastTriedAction}">Volver a intentarlo.</a>
    </li>
    <li>
        <a href="{$returnURL}" title="Página principal de USB virtual">
            Ir a la p&aacute;gina principal.
        </a>
    </li>
</ul>
